<?php
include("utils.php");

 if($_SESSION['siteuserId']=="")
{
	header("location:start.php");
}


main_content("main();");
function main()
{
	 if($_SESSION['languageId']!="")
{
	$languageId=$_SESSION['languageId'];
}
else
{
	$languageId='1';
}

	$siteUserId=$_SESSION['siteuserId'];

	$selSiteurl=mysql_query("select * from adsite_master where siteuserId='".$siteUserId."'");
	
	if(isset($_POST['next']))
	{

$_SESSION['adspace_type'] = $_POST['adspace_type'];


	
		if($_POST['ad_Type']=='network')
		{
			$netVal='Y';
		}
		else
		{
			$netVal='N';
		}

$_SESSION['netVal'] = $netVal;

	$insertAdMaster="insert into adspace_master set adsiteId='".$_POST['site_id']."', UserId='".$siteUserId."', langId='".$languageId."', ad_Type = '".$_REQUEST['ad_Type']."'";
	//echo $insertAdMaster;
	$exeAdmaster = mysql_query($insertAdMaster);
	$adspaceId = mysql_insert_id();	
	$md_no=md5($adspaceId);
$updateAdMaster=mysql_query("update adspace_master set adspaceIdMd='".$md_no."' where adspaceId='".$adspaceId."' ");
	$insertAd = "insert into adspace_details set adspaceId='".$adspaceId."', adspaceIdMd='".$md_no."',  adspaceType='".$_POST['adspace_type']."',adSize='".$_POST['size']."',fontType='".$_POST['font_type']."',backgroundColor='".$_POST['background_color']."',noOfTextAd='".$_POST['cell_count']."',headerColor='".$_POST['title_color']."',thumbOrientation='".$_POST['alignment']."',bodyColor='".$_POST['description_color']."', allowNetwork='".$netVal."' ";
	//echo $insertAd;
	$exeinsertAd = mysql_query($insertAd);
	$_SESSION['adspaceId']=$adspaceId;

//header("location:sell_space_add_details.php");
echo '<script>window.location="sell_space_add_details.php?tab=sell_ads&subMenu=2";</script>';
	
	}

?>

<!--<link rel="shortcut icon" href="https://www.etology.com/themes/etology/images/favicon.ico">-->
<link rel="stylesheet" href="css/adspace.css" type="text/css">
<link rel="stylesheet" href="css/style_002.css" type="text/css">

<script type="text/javascript" language="javascript" src="JavaScripts/common.js"></script>

<script type="text/javascript" language="javascript" src="JavaScripts/popup-layer.js"></script>

<script type="text/javascript" language="javascript" src="JavaScripts/category-list.js"></script>

<script type="text/javascript" language="javascript" src="JavaScripts/cover.js"></script>

<div id="colorlayer" onmouseover="javascript:enterColorPalette()" onmouseout="javascript:leaveColorPalette()"
    class="drag" style="visibility: hidden; width: 204px; height: 142px; position: absolute;
    z-index: 4; left: 488px; top: 635px;">
    <table bgcolor="#ffffff" border="0" cellpadding="1" cellspacing="2" width="100%">
        <tbody>
            <tr>
                <td id="selectedcolor" bgcolor="#ff8080" width="12%">
                </td>
                <td id="colorcode" align="center" width="75%">
                    <b>#FF8080</b>
                </td>
                <td width="12%">
                    <div id="transparent" style="cursor: pointer; visibility: hidden;">
                        <img src="images/transparent.gif" onmouseover="javascript:onTransparent();" onclick="javascript:onClickTransparent();preview();">
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <table id="colortable" style="border: 1px solid rgb(127, 157, 185); cursor: pointer;
        height: 115px;" bgcolor="#ffffff" border="0" cellpadding="1" cellspacing="2"
        width="100%">
        <tbody>
            <!--<tr><td bgcolor="#ff8080" height="17"></td><td bgcolor="#ffff80" height="17"></td><td bgcolor="#80ff80" height="17"></td><td bgcolor="#00ff80" height="17"></td><td bgcolor="#80ffff" height="17"></td><td bgcolor="#0080ff" height="17"></td><td bgcolor="#ff80c0" height="17"></td><td bgcolor="#ff80ff" height="17"></td></tr><tr><td bgcolor="#ff0000" height="17"></td><td bgcolor="#ffff00" height="17"></td><td bgcolor="#80ff00" height="17"></td><td bgcolor="#00ff40" height="17"></td><td bgcolor="#00ffff" height="17"></td><td bgcolor="#0080c0" height="17"></td><td bgcolor="#8080c0" height="17"></td><td bgcolor="#ff00ff" height="17"></td></tr><tr><td bgcolor="#804040" height="17"></td><td bgcolor="#ff8040" height="17"></td><td bgcolor="#00ff00" height="17"></td><td bgcolor="#008080" height="17"></td><td bgcolor="#004080" height="17"></td><td bgcolor="#8080ff" height="17"></td><td bgcolor="#800040" height="17"></td><td bgcolor="#ff0080" height="17"></td></tr><tr><td bgcolor="#800000" height="17"></td><td bgcolor="#ff8000" height="17"></td><td bgcolor="#008000" height="17"></td><td bgcolor="#008040" height="17"></td><td bgcolor="#0000ff" height="17"></td><td bgcolor="#0000a0" height="17"></td><td bgcolor="#800080" height="17"></td><td bgcolor="#8000ff" height="17"></td></tr><tr><td bgcolor="#400000" height="17"></td><td bgcolor="#804000" height="17"></td><td bgcolor="#004000" height="17"></td><td bgcolor="#004040" height="17"></td><td bgcolor="#000080" height="17"></td><td bgcolor="#000040" height="17"></td><td bgcolor="#400040" height="17"></td><td bgcolor="#400080" height="17"></td></tr><tr><td bgcolor="#000000" height="17"></td><td bgcolor="#808000" height="17"></td><td bgcolor="#808040" height="17"></td><td bgcolor="#808080" height="17"></td><td bgcolor="#408080" height="17"></td><td bgcolor="#c0c0c0" height="17"></td><td bgcolor="#400040" height="17"></td><td bgcolor="#ffffff" height="17"></td></tr>-->
        </tbody>
    </table>
    <iframe src="selling-basic-adspace-add_files/blank_003.html" style="position: absolute;
        visibility: inherit; top: 0px; left: 0px; width: 204px; height: 142px; z-index: -1;"
        frameborder="0"></iframe>
</div>

<script language="javascript" type="text/javascript">
<!--
    var transparent = "TRANSPARENT";

    var ns = document.getElementById&&!document.all; //boolean flag for netscape/firefox
    var objId; //object id
    var selected; //selected color
    var onchangeFlag = false;
    init();

    //Initialize the color table.
    function init() {
        var colors = new Array (
            ['#FF8080', '#FFFF80', '#80FF80', '#00FF80', '#80FFFF', '#0080FF', '#FF80C0', '#FF80FF'],
            ['#FF0000', '#FFFF00', '#80FF00', '#00FF40', '#00FFFF', '#0080C0', '#8080C0', '#FF00FF'],
            ['#804040', '#FF8040', '#00FF00', '#008080', '#004080', '#8080FF', '#800040', '#FF0080'],
            ['#800000', '#FF8000', '#008000', '#008040', '#0000FF', '#0000A0', '#800080', '#8000FF'],
            ['#400000', '#804000', '#004000', '#004040', '#000080', '#000040', '#400040', '#400080'],
            ['#000000', '#808000', '#808040', '#808080', '#408080', '#C0C0C0', '#400040', '#FFFFFF']
        );
        var table = document.getElementById("colortable");

        for (itr in colors) {
            var row = table.insertRow(-1);
            for (itd in colors[itr]) {
                var cell = row.insertCell(-1);
                cell.height = 17;
                cell.innerText = "";
                cell.bgColor = colors[itr][itd];

                //when move mouse to a cell, the selected color will changed
                cell.onmouseover = function() {
                    var colorcode = document.getElementById("colorcode");
                    colorcode.innerHTML = "<b>" + this.bgColor.toUpperCase() + "</b>";
                    var selectedcolor = document.getElementById("selectedcolor");
                    selectedcolor.bgColor = this.bgColor;
                    selected = selectedcolor;
                }
                //when mouse click, the selected color will be assigned to obj
                //and color palette will be closed
                cell.onclick  = function(){
                    if (objId != '') {
                        var obj = document.getElementById(objId);
                    }
                    obj.value = selected.bgColor.toUpperCase();
                    if (obj.onchange) {
                        obj.onchange();
                    }                    
                    onClickPalette('', null);
                    preview();
                };
            }
        }
    }


    //It is called when mouse over transparent cell
    function onTransparent() {
        var colorcode = document.getElementById("colorcode");
        colorcode.innerHTML = "<b>" + transparent + "</b>";
        var selectedcolor = document.getElementById("selectedcolor");
        selectedcolor.bgColor = "Transparent";
    }


    //It is called when mouseclick on transparent cell
    function onClickTransparent() {
        if (objId != '') {
            var obj = document.getElementById(objId);
        }
        obj.value = 'TRANSPARENT';
        onClickPalette('', null);
    }

    //show or hide the palette
    //it also inits table data and div position
    function onClickPalette(objid, control, isTran, leftTopDisplay) {
        if (!document.all && onchangeFlag) {
            return;
        }
        var l = 0;
        var t = 0;
        var obj;
        if (objid != '') {
            obj = document.getElementById(objid);
            objId = objid;
        }

        //check that needs the transparent or not
        var transparent = document.getElementById("transparent");
        if (typeof(isTran) != "undefined") {
            transparent.style.visibility = (isTran) ? "inherit" : "hidden";
        }
        else {
            transparent.style.visibility = "hidden";
        }

        //calculate the control position
        if (control != null) {
            controlTop = control.offsetTop;
            controlLeft = control.offsetLeft + 20;
            while(control = control.offsetParent) {
                controlTop += control.offsetTop;
                controlLeft += control.offsetLeft;
            }
        }

        //init div position
        var div = document.getElementById('colorlayer');
        if (leftTopDisplay != null) {
            leftDistance = controlLeft - div.offsetWidth;
            topDistance = controlTop - div.offsetHeight;
            div.style.left = leftDistance + "px";
            div.style.top = topDistance + "px";
        }
        else {
            div.style.left = controlLeft + "px";
            div.style.top = controlTop + "px";
        }

        //init div data
        if (div.style.visibility == 'hidden') {
            var selectedcolor = document.getElementById('selectedcolor');
            selectedcolor.bgColor = obj.value;
            var colorcode = document.getElementById('colorcode');
            colorcode.innerHTML = "<b>" + obj.value.toUpperCase() + "</b>";
        }

        div.style.visibility = (div.style.visibility == 'hidden') ? 'visible' : 'hidden';
    }

    var inColorPalette = false;
    function mousedown() {
        if (!inColorPalette) {
            var div = document.getElementById('colorlayer');
            div.style.visibility = 'hidden';
        }
    }

    function leaveColorPalette() {
        inColorPalette=false;
    }

    function enterColorPalette() {
        inColorPalette=true;
    }

    document.onmousedown = mousedown;

-->
</script>

<script language="javascript" type="text/javascript">
// <!--
//     var adspaceOnload = window.onload; 
//     window.onload = function() {
//         if (adspaceOnload) {
//             adspaceOnload();
//         }
//         //document.getElementById("adspaceType").value = 'selling-basic-adspace-add.php?sid=f02b43b24afb4d07943eb63ecfc53e9e';
//         changeRating();
//     }
// -->
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
    <tr>
        <td valign="top" align="center">
            <table border="0" align="center" cellpadding="0" cellspacing="0" class="admob-Height"
                width="90%">
                <tr>
                    <td width="244" valign="top">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
                            <tr>
                                <td valign="top">
                                    <?php include("left_pannel.php"); ?>
                                </td>
                                <td width="14" valign="top">
                                    &nbsp;
                                </td>
                                <td valign="top">
                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
                                        <tr>
                                            <td>
                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                    <tr>
                                                        <td width="14">
                                                            <img src="images/admob-BoxTopLeftCor.jpg" alt="" width="14" height="14" />
                                                        </td>
                                                        <td class="admob-BoxTopBg">
                                                            <img src="images/spacer.gif" alt="" width="10" height="10" />
                                                        </td>
                                                        <td width="14">
                                                            <img src="images/admob-BoxTopRightCor.jpg" alt="" width="14" height="14" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td valign="top" class="admob-BoxMiddleBg">
                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
                                                    <tr>
                                                        <!--	<body id="tab1">
				<ul id="tabnav">
				<li class="tab1"><a href="customize_ad.php?sid=<?php echo $_REQUEST['sid'];?>">Build Layout</a></li>
				<li class="tab2"><a href="#">Add Details</a></li>
				<li class="tab3"><a href="#">Get Code</a></li>
				</ul>
	</body>-->
                                                        <form id="basicLayout" action="" method="post" class="tight-layout">
                                                        <td width="450" valign="top">
                                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                <tr>
                                                                    <td class="admob-SquareBoxTilteBg">
                                                                        Ad Space Characteristics
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td class="admob-SquareBoxBorder">
                                                                        <table width="100%" border="0" cellpadding="0" cellspacing="2" class="admob-FormContent">
                                                                            <tr>
                                                                                <td width="150" height="25">
                                                                                    <strong>Ad Space Type:</strong>
                                                                                </td>
                                                                                <td>
                                                                                    <select id="adspaceType" name="adspace_type" class="admob-CustomizeSmallDropDown"
                                                                                        onchange="var newValue=this.value;this.selectedIndex=0;window.location.href=newValue;">
                                                                                        <!--<option value="selling-basic-adspace-add.php?sid=f02b43b24afb4d07943eb63ecfc53e9e" selected="selected">Text</option>
							  <option value="selling-banner-adspace-add.php?sid=f02b43b24afb4d07943eb63ecfc53e9e">Banner</option>
							  <option value="selling-gtb-adspace-add.php?sid=f02b43b24afb4d07943eb63ecfc53e9e">Thumbnail</option>
							  <option value="selling-cb-adspace-add.php?sid=f02b43b24afb4d07943eb63ecfc53e9e">Commercial Break</option>-->
                                                                                        <option value="text" selected="selected" onclick="window.location='customize_ad.php'">
                                                                                            Text</option>
                                                                                        <option value="banner" onclick="window.location='customize_banner.php'">Banner</option>
                                                                                        <option value="thumbnail" onclick="window.location='customize_thumbnail.php'">Thumbnail</option>
                                                                                        <option value="customize_commBreak" onclick="window.location='customize_commBreak.php'">
                                                                                            Commercial Break</option>
                                                                                    </select>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td height="25">
                                                                                    Choose a Web Site:
                                                                                </td>
                                                                                <td>
                                                                                    <select id="siteId" name="site_id" class="admob-CustomizeLargeDropDown">
                                                                                        <option label="Please Select" value="0" selected="selected">Please Select</option>
                                                                                        <!--<option label="esolzdemos(NSFW)" value="72687">esolzdemos(NSFW)</option>
								<option label="test(NSFW)" value="72719">test(NSFW)</option>-->
                                                                                        <?php while($fetSiteUrl=mysql_fetch_array($selSiteurl)) { ?>
                                                                                        <option label="<?=$fetSiteUrl['adSiteUrl']?>" value="<?=$fetSiteUrl['adsiteId']?>"><?=$fetSiteUrl['adSiteUrl']?></option>
                                                                                        <?php } ?>
                                                                                    </select>
                                                                                    <!--<a href="#" onclick="javascript:openWindow('help-rating.php?sid=f02b43b24afb4d07943eb63ecfc53e9e', 500, 420, true, true);return false;" style="color: rgb(0, 0, 255); font-weight: bold; text-decoration: none;" onmouseover="style.textDecoration='underline'" onmouseout="style.textDecoration='none'">What's this?</a>-->
                                                                                </td>
                                                                            </tr>
                                                                            <!-- <tr>
					  <td>Rating:</td>
					  <td>
						<div id="websiteRating"></div>
					  </td>
					</tr>-->

                                                                            <script type="text/javascript" language="javascript" src="selling-basic-adspace-add_files/js.html"></script>

                                                                            <script type="text/javascript" language="javascript" src="selling-basic-adspace-add_files/form.js"></script>

                                                                            <tr>
                                                                                <td height="25">
                                                                                    #Ads:
                                                                                </td>
                                                                                <td>
                                                                                    <select id="cellCount" name="cell_count" class="admob-CustomizeDropDown" onchange="javascript: preview();">
                                                                                        <option label="1" value="1" selected="selected">1</option>
                                                                                        <option label="2" value="2">2</option>
                                                                                        <option label="3" value="3">3</option>
                                                                                        <option label="4" value="4">4</option>
                                                                                        <option label="5" value="5">5</option>
                                                                                        <option label="6" value="6">6</option>
                                                                                        <option label="7" value="7">7</option>
                                                                                        <option label="8" value="8">8</option>
                                                                                        <option label="9" value="9">9</option>
                                                                                        <option label="10" value="10">10</option>
                                                                                        <option label="11" value="11">11</option>
                                                                                        <option label="12" value="12">12</option>
                                                                                        <option label="13" value="13">13</option>
                                                                                        <option label="14" value="14">14</option>
                                                                                        <option label="15" value="15">15</option>
                                                                                        <option label="16" value="16">16</option>
                                                                                        <option label="17" value="17">17</option>
                                                                                        <option label="18" value="18">18</option>
                                                                                        <option label="19" value="19">19</option>
                                                                                        <option label="20" value="20">20</option>
                                                                                    </select>
                                                                                </td>
                                                                            </tr>
                                                                            <!--######################### code on 29_06_09 starts####################-->
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    #Ads Type:
                                                                                </td>
                                                                                <td>
                                                                                    <select id="ad_Type" name="ad_Type" class="admob-CustomizeDropDownBig">
                                                                                        <option label="direct" value="direct" selected="selected">Direct</option>
                                                                                        <option label="network" value="network">Network</option>
                                                                                    </select>
                                                                                </td>
                                                                            </tr>
                                                                            <!--######################### code on 29_06_09 ends #####################-->
                                                                            <tr>
                                                                                <td height="40%">
                                                                                    View:
                                                                                </td>
                                                                                <td>
                                                                                    <div id="horizontalView">
                                                                                        <input id="horizontal" name="alignment" value="horizontal" onclick="javascript: preview();"
                                                                                            type="radio"><label for="horizontal">Horizontal</label></div>
                                                                                    <div id="verticalView">
                                                                                        <input id="vertical" name="alignment" value="vertical" checked="checked" onclick="javascript: preview();"
                                                                                            type="radio"><label for="vertical">Vertical</label></div>
                                                                                </td>
                                                                            </tr>
                                                                            <!--         <tr><td colspan="2"><hr></td></tr>   -->
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    Standard Size:
                                                                                </td>
                                                                                <td>
                                                                                    <select id="size" name="size" class="admob-CustomizeLargeDropDown" onchange="javascript: if('160x100'==this.value)restoreDefaultSize();else preview();">
                                                                                        <option label="None" value="160x100" selected="selected">None</option>
                                                                                        <option label="Standard Rectangle (184 x 360)" value="184x360">Standard Rectangle (184
                                                                                            x 360)</option>
                                                                                        <option label="Full Banner (468 x 60)" value="468x60">Full Banner (468 x 60)</option>
                                                                                        <option label="Half Banner (234 x 60)" value="234x60">Half Banner (234 x 60)</option>
                                                                                        <option label="Leader Board (728 x 90)" value="728x90">Leader Board (728 x 90)</option>
                                                                                        <option label="Square Button (125 x 125)" value="125x125">Square Button (125 x 125)</option>
                                                                                        <option label="Vertical Banner (120 x 240)" value="120x240">Vertical Banner (120 x 240)</option>
                                                                                        <option label="Small Rectangle (180 x 150)" value="180x150">Small Rectangle (180 x 150)</option>
                                                                                        <option label="Medium Rectangle (300 x 250)" value="300x250">Medium Rectangle (300 x
                                                                                            250)</option>
                                                                                        <option label="Large Rectangle (336 x 280)" value="336x280">Large Rectangle (336 x 280)</option>
                                                                                        <option label="Square Pop-up (250 x 250)" value="250x250">Square Pop-up (250 x 250)</option>
                                                                                        <option label="Skyscraper (120 x 600)" value="120x600">Skyscraper (120 x 600)</option>
                                                                                        <option label="Wide Skyscraper (160 x 600)" value="160x600">Wide Skyscraper (160 x 600)</option>
                                                                                    </select>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    Font Type:
                                                                                </td>
                                                                                <td>
                                                                                    <select id="fontType" name="font_type" class="admob-CustomizeDropDownBig" onchange="javascript: preview();">
                                                                                        <option label="Arial" value="Arial" selected="selected">Arial</option>
                                                                                        <option label="Georgia" value="Georgia">Georgia</option>
                                                                                        <option label="Sans-serif" value="MS Sans Serif">Sans-serif</option>
                                                                                        <option label="Times" value="Times">Times</option>
                                                                                        <option label="Verdana" value="Verdana">Verdana</option>
                                                                                    </select>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    Background Color:
                                                                                </td>
                                                                                <td>
                                                                                    <input id="backgroundColor" name="background_color" class="admob-CustomizeInputBox"
                                                                                        size="10" maxlength="11" value="#E8E8E8" onchange="javascript: commonPreview(preview);"
                                                                                        type="text"><a class="colorformat">Background Color</a><img style="cursor: pointer;
                                                                                            padding-left: 3px;" src="images/palette.gif" alt="Palette" onclick="javascript: onClickPalette('backgroundColor', this, true);">
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    Headline Color:
                                                                                </td>
                                                                                <td>
                                                                                    <input id="titleColor" name="title_color" class="admob-CustomizeInputBox" size="10"
                                                                                        maxlength="10" value="#0000FF" onchange="javascript: commonPreview(preview);"
                                                                                        type="text"><a class="colorformat">Headline Color</a><img style="cursor: pointer;
                                                                                            padding-left: 3px;" src="images/palette.gif" alt="Palette" onclick="javascript: onClickPalette('titleColor', this);">
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    Description Color:
                                                                                </td>
                                                                                <td>
                                                                                    <input id="descriptionColor" name="description_color" class="admob-CustomizeInputBox"
                                                                                        size="10" maxlength="10" value="#000000" onchange="javascript: commonPreview(preview);"
                                                                                        type="text"><a class="colorformat">Description Color</a><img style="cursor: pointer;
                                                                                            padding-left: 3px;" src="images/palette.gif" alt="Palette" onclick="javascript: onClickPalette('descriptionColor', this);">
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td height="25%">
                                                                                    Hide Broker Link:
                                                                                </td>
                                                                                <td>
                                                                                    <select id="brokerLinkHide" name="broker_link_hide" class="admob-CustomizeDropDown"
                                                                                        onchange="javascript: hideBrokerLink(); preview();">
                                                                                        <option value="No" selected="selected">No</option>
                                                                                        <option value="Yes">Yes</option>
                                                                                    </select><br />
                                                                                    <a href="javascript: restoreDefault();" class="admob-RightLink">restore defaults</a>
                                                                                </td>
                                                                    </td>
                                                                </tr>

                                                                <script language="javascrip" type="text/javascript">
					<!--
					var message_warning_not_allow_network = "Warning! Network ads allow this ad space to always generate revenue, regardless of a direct ad purchase. If you choose to continue, please set your desired sale price for this ad space.";
					function checkSelect(obj) {
						if (false == obj.checked) {
							if(!confirm(message_warning_not_allow_network)) {
								obj.checked = true;
							}
						}
					}
					-->
					</script>

                                                                <tr>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td height="25">
                                                                        &nbsp;
                                                                    </td>
                                                                    <td>
                                                                        <table border="0" align="left" cellpadding="0" cellspacing="0">
                                                                            <tr>
                                                                                <td>
                                                                                    <input id="customAdSpace" name="custom_adspace" value="" disabled="disabled" type="hidden">
                                                                                    <input name="back" value="&lt; Back" class="admob-InputButton" onclick="javascript: window.location.href='#'"
                                                                                        type="button">
                                                                                </td>
                                                                                <td width="10">
                                                                                    &nbsp;
                                                                                </td>
                                                                                <td>
                                                                                    <input name="next" value="Next &gt;" class="admob-InputButton" onclick="javascript: return validateSite(); "
                                                                                        type="submit">
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <td width="13" valign="top">
                                                &nbsp;
                                            </td>
                                            <td width="450" valign="top">
                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                    <tr>
                                                        <td class="admob-SquareBoxTilteBg">
                                                            Preview
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="admob-SquareBoxBorder">
                                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                <tr>
                                                                    <td>
                                                                        <div style="padding: 3px; text-align: left;">
                                                                            <!--<div style="display: block;"><span class="warning">Warning: The ad cannot be shown correctly because the specified size is too small.</span><br><br></div>-->
                                                                            <table id="pTable" style="border: 0px solid rgb(127, 157, 185); text-align: center;"
                                                                                cellpadding="0" cellspacing="0">
                                                                                <tbody>
                                                                                    <tr id="pTr">
                                                                                        <td id="pTd">
                                                                                            <table style="width: 640px; height: 79px; table-layout: fixed;" border="0" cellpadding="6"
                                                                                                cellspacing="6">
                                                                                                <tbody>
                                                                                                    <!--<tr><td align="center" bgcolor="#ff8080" valign="top"><div style="overflow: hidden; width: 141px; height: 55px;" id="ad_0"><div style="color: rgb(0, 0, 255); font-family: Arial; font-size: 13px; font-weight: bold; text-decoration: underline;">Headline Goes Here</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 13px;">Ad description will go ...</div></div></td><td align="center" bgcolor="#ff8080" valign="top"><div style="overflow: hidden; width: 141px; height: 55px;" id="ad_1"><div style="color: rgb(0, 0, 255); font-family: Arial; font-size: 13px; font-weight: bold; text-decoration: underline;">Headline Goes Here</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 13px;">Ad description will go ...</div></div></td><td align="center" bgcolor="#ff8080" valign="top"><div style="overflow: hidden; width: 141px; height: 55px;" id="ad_2"><div style="color: rgb(0, 0, 255); font-family: Arial; font-size: 13px; font-weight: bold; text-decoration: underline;">Headline Goes Here</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 13px;">Ad description will go ...</div></div></td><td align="center" bgcolor="#ff8080" valign="top"><div style="overflow: hidden; width: 141px; height: 55px;" id="ad_3"><div style="color: rgb(0, 0, 255); font-family: Arial; font-size: 13px; font-weight: bold; text-decoration: underline;">Headline Goes Here</div><div style="color: rgb(0, 0, 0); font-family: Arial; font-size: 13px;">Ad description will go ...</div></div></td></tr>-->
                                                                                                </tbody>
                                                                                            </table>
                                                                                        </td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td style="text-align: left; height: 15px;">
                                                                                            <div id="brokerLink" style="border-width: 0px; display: inline; font-size: 11px;
                                                                                                font-family: arial; color: rgb(0, 0, 0); text-decoration: none; font-weight: normal;
                                                                                                font-style: normal;">
                                                                                                <a href="#" class="admob-RightLink"><span id="brokerLinkSpan">Advertise Here</span></a></div>
                                                                                        </td>
                                                                                    </tr>
                                                                                </tbody>
                                                                            </table>

                                                                            <script language="javascript" type="text/javascript">
<!--
var confirm_hide_link = "Are you sure? If you hide the link, people will not be able to advertise on your site or become your affiliate.";
var descriptionString = "Ad description will go here below the Headline.";
var titleString = "Headline Goes Here";
var descString = "Ad description will go here.";
// var warningMessage = "Warning: ";
// warningMessage += "The ad cannot be shown correctly because the specified size is too small.";
-->
</script>

                                                                            <script language="javascript" type="text/javascript">
<!--
function showWarning(isOverflow) {
    warning.style.display = isOverflow ? 'block' : 'none';
}

function hideBrokerLink(){
   if ("Yes" == document.getElementById("brokerLinkHide").value) {
       if (!window.confirm(confirm_hide_link)) {
           document.getElementById("brokerLinkHide").value = "No";
       }
   }            
}

function restoreDefault() {
    if (!document.all && onchangeFlag) {
        return;
    }
    if (null != document.getElementById("siteId")) {
        document.getElementById("siteId").options[0].selected = true;
        changeRating();
    }
    document.getElementById("size").options[0].selected = true;
    document.getElementById("vertical").checked = true;
    document.getElementById("cellCount").options[0].selected = true;
    document.getElementById("backgroundColor").value = "#E8E8E8";
    document.getElementById("titleColor").value = "#0000FF";
    document.getElementById("descriptionColor").value = "#000000";
    document.getElementById("fontType").value = "Arial";
    document.getElementById("brokerLinkHide").options[0].selected = true;
    preview();
}

function restoreDefaultSize() {
    document.getElementById("cellCount").options[0].selected = true;
    document.getElementById("vertical").checked = true;
    preview();
}

function preview() {
    var elementTitleColor = document.getElementById("titleColor");
    var elementDescriptionColor = document.getElementById("descriptionColor");
    var elementBgColor = document.getElementById("backgroundColor");
    var reg = /^#[0-9a-fA-F]{6}$/;
    if ('TRANSPARENT' != elementBgColor.value && ! reg.test(elementBgColor.value)) {
        alert(alert_color_incorrect.replace('<field name>', elementBgColor.nextSibling.firstChild.nodeValue));
        focusElement(elementBgColor);
        return;
    }
    if (! reg.test(elementTitleColor.value)) {
        alert(alert_color_incorrect.replace('<field name>', elementTitleColor.nextSibling.firstChild.nodeValue));
        focusElement(elementTitleColor);
        return;
    }
    if (! reg.test(elementDescriptionColor.value)) {
        alert(alert_color_incorrect.replace('<field name>', elementDescriptionColor.nextSibling.firstChild.nodeValue));
        focusElement(elementDescriptionColor);
        return;
    }
    var fontName = document.getElementById("fontType").value;          
    var titleColor = document.getElementById("titleColor").value;
    var descriptionColor = document.getElementById("descriptionColor").value;
    var bgColor = document.getElementById("backgroundColor").value;
    var size = document.getElementById("size").value;
    document.getElementById("horizontal").disabled = true;
    document.getElementById("vertical").disabled = true;
    document.getElementById("cellCount").disabled = true;
    var alignment = "vertical";
    var titleFontSize = "13px";
    var descriptionFontSize = "13px";
    var titleText = titleString;
    var descriptionText = descriptionString;
    cellSpacing = 6;
    cellPadding = 6;
    rows = 1;
    cols = 1;
    sizes = size.split("x");
    totalWidth = sizes[0];
    totalHeight = sizes[1];

    switch (size) {
        case "184x360" :
            ads = 5;
            rows = 5;
            descriptionFontSize = "12px";
            break;
        case "468x60" :
            ads = 2;
            cellSpacing = 6;
            alignment = "horizontal";
            cols = 2;
            titleFontSize = "12px";
            descriptionFontSize = "11px";
            break;
        case "234x60" :
            ads = 1;
            cellSpacing = 6;
            titleFontSize = "12px";
            descriptionFontSize = "12px";
            break;
        case "728x90" :
            ads = 5;
            alignment = "horizontal";
            cols = 5;
            descriptionFontSize = "12px";
            descriptionText = descString;
            break;
        case "125x125" :
            ads = 1;
            cellSpacing = 0;
            titleFontSize = "12px";
            descriptionFontSize = "12px";
            break;
        case "120x240" :
            ads = 3;
            rows = 3;
            titleFontSize = "12px";
            descriptionFontSize = "12px";
            descriptionText = descString;
            break;
        case "180x150" :
            ads = 1;
            titleFontSize = "12px";
            descriptionFontSize = "12px";
            break;
        case "300x250" :
            ads = 4;
            cols = 2;
            rows = 2;
            break;
        case "336x280" :
            ads = 6;
            cols = 3;
            rows = 2;
            break;
        case "250x250" :
            ads = 4;
            cols = 2;
            rows = 2;
            break;
        case "120x600" :
            ads = 6;
            rows = 6;
            break;
        case "160x600" :
            ads = 7;
            rows = 7;
            break;
        default :
            document.getElementById("horizontal").disabled = false;
            document.getElementById("vertical").disabled = false;
            document.getElementById("cellCount").disabled = false;
            ads = document.getElementById("cellCount").value;
            cellSpacing = 6;
            if (document.getElementById("horizontal").checked) {
                alignment = "horizontal";
                cols = parseInt(ads);
            }
            else {
                rows = parseInt(ads);
            }
            width = sizes[0];
            height = sizes[1];
            totalWidth = width*cols;
            totalHeight = height*rows;
            break;
    }

    if ("vertical" == alignment) {
        document.getElementById("vertical").checked = true;
    }
    else {
        document.getElementById("horizontal").checked = true;
    }

    if ("No" == document.getElementById("brokerLinkHide").value) {
        totalHeight -= 21;
    }
    temp = cellPadding * (rows * 2) + cellSpacing * (rows + 1);
    height = Math.round((totalHeight - temp)/rows);
    temp = cellPadding * (cols * 2) + cellSpacing * (cols + 1);
    width = Math.round((totalWidth - temp)/cols);

    document.getElementById("cellCount").value = ads;
    document.getElementById("pTd").innerHTML = "";
    previewTable = document.createElement("TABLE");
    previewTableBody = document.createElement("TBODY");
    var index = 0;
    var ad_elements = new Array();
    for(j = 0; j < rows; j++) {
        currentRow = document.createElement("TR");
        for(i = 0; i < cols;i++) {
            currentCell = document.createElement("TD");
            if ("" != bgColor) {
                currentCell.bgColor = bgColor;
            }
            currentCell.vAlign = "top";
            currentCell.align = "center";
            content = document.createElement("DIV");
            content.id = "ad_" + index;
            ad_elements[index++] = content;
            content.style.overflow = "hidden";
            content.style.width = width + "px";
            content.style.height = height + "px";
            title = document.createElement("DIV");
            title.style.color = titleColor;
            title.style.fontFamily = fontName;
            title.style.fontSize = titleFontSize;
            title.style.fontWeight = "bold";
            title.style.textDecoration = "underline";
            titleContent = document.createTextNode(titleString);
            title.appendChild(titleContent);

            description = document.createElement("DIV");
            description.style.color = descriptionColor;
            description.style.fontFamily = fontName;
            description.style.fontSize = descriptionFontSize;
            descriptionContent = document.createTextNode(descriptionText);
            description.appendChild(descriptionContent);
            content.appendChild(title);
            content.appendChild(description);
            currentCell.appendChild(content);
            currentRow.appendChild(currentCell);
        }
        previewTableBody.appendChild(currentRow);
    }

    var brokerLinkElement = document.getElementById("brokerLink");

    if ("No" == document.getElementById("brokerLinkHide").value) {
        brokerLinkElement.style.display = "inline";
    }
    else {
        brokerLinkElement.style.display = "none";
    }
    previewTable.brokerLinkSpan = document.getElementById('brokerLinkSpan');
    previewTable.totalWidth = totalWidth;
    previewTable.appendChild(previewTableBody);
    previewTable.setAttribute("border", "0");
    previewTable.cellSpacing = cellSpacing;
    previewTable.cellPadding = cellPadding;
    previewTable.style.width = totalWidth + "px";
    previewTable.style.height = totalHeight + "px";
    previewTable.style.tableLayout = "fixed";

    document.getElementById("pTd").appendChild(previewTable);
    var striped = stripAllContents(ad_elements);
    if ("No" == document.getElementById("brokerLinkHide").value) {
        striped |= stripBrokerLink(previewTable);
    }

    if (isIE7()) {
        controlIE7Performance();
    }
    
    showWarning(striped);
    if ('undefined' != typeof(isChanged)){
       isChanged = true;
    }
}

var oldOnload = window.onload;
window.onload = function() {
    if (oldOnload) {
        oldOnload();
    }
    warning = document.createElement('div');
    warning.style.display = 'none';
    var previewTable = document.getElementById("pTable")
    previewTable.parentNode.insertBefore(warning, previewTable);
   // warning.innerHTML = '<span class="warning">' + warningMessage + '</span><br /><br />';

    preview();
    if ('undefined' != typeof(isChanged)){
       isChanged = false;
       addLinksCheckChange(leave_message);
    }
}
-->
</script>

                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                </tbody></table>
                                                        </td>
                                                    </tr>
                                                    </tbody></table>
                                                </form>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td width="14">
                                                <img src="images/admob-BoxBottomLeftCor.jpg" alt="" width="14" height="14" />
                                            </td>
                                            <td class="admob-BoxBottomBg">
                                                <img src="images/spacer.gif" alt="" width="10" height="10" />
                                            </td>
                                            <td width="14">
                                                <img src="images/admob-BoxBottomRightCor.jpg" alt="" width="14" height="14" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

<script language="javascrip" type="text/javascript">
<!--
var websites_rating = new Array();
    websites_rating['72687'] = 'nsfw';
    websites_rating['72719'] = 'nsfw';
var ratings = {'sfw' : 'Safe For Work', 'nsfw' : 'Not Safe For Work', 'adult' : 'Adult'};

function validateSite() {
    if ("0" == document.getElementById("siteId").value) {
        alert("Please choose a website from the dropdown list");
        document.getElementById("siteId").focus();
        return false;
    }

    return validateForm(document.getElementById("basicLayout"));
}


function storeLayout() {
    document.getElementById('customAdSpace').disabled = false;
    document.getElementById('basicLayout').submit();
    return false;
}

// function changeRating() {
//     var website = document.getElementById('siteId');
//     var contentRating = ratings[websites_rating[website.value]];
//     document.getElementById('websiteRating').innerHTML = (contentRating) ? contentRating : '';
// }
-->
</script>
<?php
}
?>